<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <canvas style="border:1px solid red" width="500" height="400"></canvas>
  <script>
    var canvas = document.querySelector('canvas')
    var ctx = canvas.getContext('2d')
    
    ctx.beginPath()
    ctx.moveTo(100,100)
    ctx.lineTo(300,200)
    ctx.lineTo(200,300)
    ctx.closePath()
    ctx.stroke()

  </script>
</body>
</html>